home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 3 / BBS in a box - Trilogy III.iso / Files / System7 tools / Frontier / Frontier SDK 2.1 / Toolkits / IAC Tools / iaclong.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-09  |  1.5 KB  |  75 lines  |  [TEXT/KAHL]

  1.  
  2. /*© Copyright 1988-1993 UserLand Software, Inc.  All Rights Reserved.*/
  3.  
  4. #include "iacinternal.h"
  5.  
  6.  
  7.  
  8. Boolean IACpushlongparam (long val, OSType keyword) {
  9.  
  10.     return (IACpushlongitem (IACglobals.event, val, keyword));
  11.     } /*IACpushlongparam*/
  12.  
  13.  
  14. Boolean IACreturnlong (long x) {
  15.     
  16.     return (IACpushlongitem (IACglobals.reply, x, keyDirectObject));
  17.     } /*IACreturnlong*/
  18.  
  19.  
  20. Boolean IACgetlongparam (OSType keyword, long *val) {
  21.  
  22.     if (!IACgetlongitem (IACglobals.event, keyword, val)) {
  23.  
  24.         IACparamerror (IACglobals.errorcode, "\plong", keyword);
  25.         
  26.         return (false);
  27.         }
  28.     
  29.     IACglobals.nextparamoptional = false; /*must be reset for each param*/
  30.     
  31.     return (true);
  32.     } /*IACgetlongparam*/
  33.     
  34.     
  35. Boolean IACgetlongitem (AEDescList *list, long n, long *val) {
  36.     
  37.     register OSErr ec;
  38.     DescType key;
  39.     DescType typeCode;
  40.     Size actualSize;
  41.     
  42.     if ((*list).descriptorType != typeAEList) {
  43.         
  44.         ec = AEGetKeyPtr (list, n, typeLongInteger, &typeCode, (Ptr) val, sizeof (*val), &actualSize);
  45.  
  46.         if (ec != errAEDescNotFound)
  47.             goto done;
  48.         }
  49.  
  50.     ec = AEGetNthPtr (list, n, typeLongInteger, &key, &typeCode, (Ptr) val, sizeof (*val), &actualSize);
  51.     
  52.     done:
  53.     
  54.     IACglobals.errorcode = ec;
  55.     
  56.     return (ec == noErr);
  57.     } /*IACgetlongitem*/
  58.  
  59.  
  60. Boolean IACpushlongitem (AEDescList *list, long val, long n) {
  61.     
  62.     register OSErr ec;
  63.     
  64.     if ((*list).descriptorType != typeAEList)
  65.         ec = AEPutKeyPtr (list, n, typeLongInteger, (Ptr)&val, sizeof (val));
  66.     else
  67.         ec = AEPutPtr (list, n, typeLongInteger, (Ptr)&val, sizeof (val));
  68.     
  69.     IACglobals.errorcode = ec;
  70.     
  71.     return (ec == noErr);
  72.     } /*IACpushlongitem*/
  73.  
  74.  
  75.